<?php

class LogOnComponents {
	
	public static function getHomePage() {
		$alert = '';
		if (isset($_POST['login']['username']) && isset($_POST['login']['password'])) {
			if (!Auth::getFirstLogin())
				$alert = '<span class="text-danger">Invalid username and password.</span>';
		}
		return LogOnComponents::getLogOnForm($alert);
	}
	
	private static function getLogOnForm($alert = '') {
		
		return <<<CONTENT
			<form action="/" method="post">
				<fieldset>
					<legend>Log-in:</legend>
					<div class="form-group">
						<label for="username">
							Username:
						</label>
						<input type="text" id="username" name="login[username]" value="" class="form-control" />
					</div>
					<div class="form-group">
						<label for="password">
							Password:
						</label>
						<input type="password" id="password" name="login[password]" value="" class="form-control"/>
					</div>
					<input type="hidden" value="1" name="submit"/>
					<input type="submit" class="btn btn-default" value="log-in"/>
					{$alert}
				</fieldset>
			</form>
CONTENT;
	}
	
	
	
}